package com.example.user.handler;

import com.example.entity.JsonData;
import com.example.user.exception.TokenIsWrongException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyExceptionHandler {
    @ExceptionHandler(TokenIsWrongException.class)
    public Object tokenIsWrong(TokenIsWrongException tokenIsWrongException) {
        return JsonData.buildError(tokenIsWrongException.getMessage(), 400);
    }
}
